package org.batatasframework.support.database;

import org.batatasframework.support.database.sql.TableInstance;
import org.springframework.util.Assert;


public abstract class AbstractTargetTable<T extends TableInstance> implements AliasNamed{

	protected final TableInfo tableInfo;
	
	protected final T tableInstance;
	
	public AbstractTargetTable(T tableInstance, TableInfo tableInfo){		
		Assert.notNull(tableInfo, "数据库名必须不能为空");

		this.tableInstance = tableInstance;
		this.tableInfo = tableInfo;
	}
	
	@Override
	public String getAlias() {
		return tableInstance.getAlias();
	}

	public String getTargetTableName(){
		return tableInfo.getTableName();
	}
	
}
